﻿function getResponse(asyncUrl) {


    var currentDate = new Date();
    var sendMessage = JSON.stringify({
        SendTimestamp: currentDate,
        Message: "Message 1"
    });

    $.ajaxSetup({
        url: asyncUrl,
        type: "POST",
        async: true,
        global: true,
        timeout: 600000
    });


    $.ajax({
        success: function (msg) {
            //alert("ajax.success().");
            if (msg == null) {
                return;
            }

            var textToAppend = msg;

            if (msg.Message != null) {
                textToAppend = msg.Message;
            }

            $("#_receivedMsgLabel").append(textToAppend + "<br/>");
            return;
        },

        error: function (jqXHR, status, error) {

        },

        complete: function () {
            getResponse();
            return;
        }

    });

}
